Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera callbacks replaced by the events #7156

Merged
merged 6 commits into from
Nov 29, 2024
Merged

Camera callbacks replaced by the events #7156

merged 6 commits into from
Nov 29, 2024

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Nov 29, 2024

based on the discussion here: #7151

The callbacks on the CameraComponent:

onPreRender
onPreRenderLayer
onPostRender
onPostRenderLayer
onPreCull
onPostCull

where replaced by matching events fired on Scene to allow multiple subscribes.

The callbacks were removed, and the user get an error when they try to access them, suggesting a replacement.

Screenshot 2024-11-29 at 15 08 33 Screenshot 2024-11-29 at 15 08 44

@willeastcott
Copy link
Contributor

Please search for @event in the codebase. Generally speaking, the standard format for event name strings in the codebase is all lower case (rather than camel-case). There are instances of name:subname which I'm not averse to in some situations.

@willeastcott
Copy link
Contributor

Also, you'll see that in @example sections for @event blocks, we don't actually suggest using the constant. The string is used directly. The constant is really just a symbol to make an entry in the docs.

@mvaligursky
Copy link
Contributor Author

The string is used directly.

Maybe we should consider changing it, as that's not consistent with all other constants engine exports that users use.
But that's a separate discussion / PR.

@willeastcott
Copy link
Contributor

The string is used directly.

Maybe we should consider changing it, as that's not consistent with all other constants engine exports that users use. But that's a separate discussion / PR.

Well, it's consistent with the event documentation at least. 😄 Honestly, take a look.

src/scene/scene.js Outdated Show resolved Hide resolved
Copy link
Contributor

@willeastcott willeastcott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 👏

@mvaligursky mvaligursky merged commit 5268fe3 into main Nov 29, 2024
8 checks passed
@mvaligursky mvaligursky deleted the mv-camera-events branch November 29, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants